/*
 * @lc app=leetcode.cn id=485 lang=rust
 *
 * [485] 最大连续 1 的个数
 */

// @lc code=start
impl Solution {
    pub fn find_max_consecutive_ones(nums: Vec<i32>) -> i32 {
        let mut ret = 0;

        let mut tmp = 0;

        for i in 0..nums.len() {
            if nums[i] == 1{
                tmp += 1;
            }
            else{
                if ret < tmp{
                    ret = tmp;
                }
                tmp = 0;
            }
        }
        if ret < tmp{
            ret = tmp;
        }
        return ret;
    }
}
// @lc code=end

